home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 November / Chip Kasım 2003.iso / prog / openoff / f_0153 / DialogModul.xba < prev    next >
Encoding:
Extensible Markup Language  |  2003-01-30  |  19.3 KB  |  523 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
  3. <script:module xmlns:script="http://openoffice.org/2000/script" script:name="DialogModul" script:language="StarBasic">Option Explicit
  4.  
  5. Public Const bDebugWizard = True
  6.  
  7. Public Const SBFIRSTAPPLCHECKED = 0
  8. Public Const SBSECONDAPPLCHECKED = 1
  9. Public Const SBTHIRDAPPLCHECKED = 2
  10. Public Const SBFOURTHAPPLCHECKED = 3
  11. Public WizardMode as String
  12. Public Const SBMICROSOFTMODE = "MS"
  13. Public Const SBXMLMODE = "SO"
  14. ' The absolute maximal Number of possible Applications
  15. Public Const Twip = 425
  16. Public Const SBMAXAPPLCOUNT = 4
  17. Public MaxApplCount as Integer
  18. Public CurOffice As Integer
  19. Public SOBitmapPath As String
  20. Public SOWorkPath As String
  21. Public SOTemplatePath as String
  22. Public bCancelTask As Boolean
  23. Public bDoKeepApplValues as Boolean
  24. Public iApplSection as Integer
  25. Public oUcb as Object
  26. Public PathSeparator as String
  27.  
  28. Public ApplCount as Integer
  29. Public sKeyName(SBMAXAPPLCOUNT-1) as String
  30. Public sValueName(SBMAXAPPLCOUNT-1) as String
  31. Public sCRLF as String
  32. Public MSFilterName(5,2) as String
  33. Public XMLFilterName(7,2) as String
  34.  
  35. ' e.g.:
  36. ' XMLFilterName(x,0) = "sdw"                         ' in documents we take the extensions; in SO-templates the appropriate Filtername
  37. ' XMLFilterName(x,1) = "swriter: StarWriter 5.0"     ' the filtername of the target-format
  38. ' XMLFilterName(x,2) = "sxw"                         ' the target extension
  39.  
  40. Public Applications(SBMAXAPPLCOUNT-1,9)
  41.  
  42. Public Const SBAPPLCONVERT = 0
  43. Public Const SBDOCCONVERT = 1
  44. Public Const SBDOCRECURSIVE = 2
  45. Public Const SBDOCSOURCE = 3
  46. Public Const SBDOCTARGET = 4
  47. Public Const SBTEMPLCONVERT = 5
  48. Public Const SBTEMPLRECURSIVE = 6
  49. Public Const SBTEMPLSOURCE = 7
  50. Public Const SBTEMPLTARGET = 8
  51. Public Const SBAPPLKEY = 9
  52.  
  53. ' Application-relating Data are stored in this Array
  54. ' according to the following structure:
  55. ' Applications(X,0) = True/False         (Application is to be converted)
  56. ' Applications(X,1) = True/False         (Documents are to be converted)
  57. ' Applications(X,2) = True/False        (Including Subdirectories)
  58. ' Applications(X,3) = "File:///..."        (SourceUrl of the documents)
  59. ' Applications(X,4) = "File///:..."        (TargetUrl of the documents)
  60. ' Applications(X,5) = True/False        (Templates are to be converted)
  61. ' Applications(X,6) = True/False         (Including Subdirectories)
  62. ' Applications(X,7) = "File:///..."        (SourceUrl of the templates)
  63. ' Applications(X,8) = "File:///..."     (TargetUrl of the templates)
  64. ' Applications(X,9) = 0                    (Key to the original Index of the Applications)
  65.  
  66. Public Const SBMAXEXTENSIONLENGTH = 7
  67.  
  68.  
  69. Sub FillStep_Welcome()
  70. Dim i as Integer
  71. '    bDoKeepApplValues = False
  72.     ImportDialogArea.Title = sTitle
  73.     With ImportDialog
  74.         .cmdHelp.Label = sHelpButton
  75.         .cmdCancel.Label = sCancelButton
  76.         .cmdBack.Label = sBackButton
  77.         .cmdGoOn.Label = sNextButton
  78.         .WelcomeTextLabel.Label = sWelcomeTextLabel1
  79.         .WelcomeTextLabel2.Label = sWelcomeTextLabel2
  80.         .WelcomeTextLabel3.Label = sWelcomeTextLabel3
  81.  
  82.         .optMSDocuments.Label = sContainerName(0)
  83.         .chkMSApplication1.Label = sMsDocumentCheckbox(0)
  84.         .chkMSApplication2.Label = sMsDocumentCheckbox(1)
  85.         .chkMSApplication3.Label = sMsDocumentCheckbox(2)
  86.  
  87.         .optSODocuments.Label = sContainerName(1)
  88.         .chkSOApplication1.Label = sSODocumentCheckbox(0)
  89.         .chkSOApplication2.Label = sSODocumentCheckbox(1)
  90.         .chkSOApplication3.Label = sSODocumentCheckbox(2)
  91.         .chkSOApplication4.Label = sSODocumentCheckbox(3)
  92.         .cmdBack.Enabled = False
  93.         .Step = 1
  94.         
  95.         If Not oFactoryKey.hasbyName("com.sun.star.text.TextDocument") Then
  96.             .chkLogfile.State = 0
  97.             .chkLogfile.Enabled = False
  98.         End If    
  99.     End With
  100.     CheckModuleInstallation()
  101.     ToggleNextButton()
  102. End Sub
  103.  
  104.  
  105. Sub FillStep_InputPaths(OfficeIndex as Integer, bStartup as Boolean)
  106. Dim Index as Integer
  107. Dim oNullObject as Object
  108.     If bStartup And Not bDoKeepApplValues Then
  109.         If ImportDialog.optMSDocuments.State = 1 Then
  110.             SetupMSConfiguration()
  111.         Else
  112.             SetupXMLConfiguration()
  113.         End If
  114.         ' chkTemplatePath-Captions
  115.         GetApplResourceArray(1009 + iApplSection, ApplCount, sTemplateCheckBox())
  116.         ' DocumentCheckbox- Captions
  117.         GetApplResourceArray(1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
  118.         FillUpApplicationList()
  119.     End If
  120.     CurOffice = OfficeIndex
  121.     Index = Applications(CurOffice,SBAPPLKEY)
  122.     InitializePathsforCurrentApplication(Index)
  123.     With ImportDialog
  124.         .chkTemplatePath.Label = sTemplateCheckbox(Index)
  125.         .chkDocumentPath.State = Abs(Applications(CurOffice,SBDOCCONVERT))
  126.            .chkDocumentSearchSubDir.State = Abs(Applications(CurOffice,SBDOCRECURSIVE))
  127.         .txtDocumentImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCSOURCE))
  128.         .txtDocumentExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCTARGET))
  129.         .hlnDocuments.Label = sProgressMoreDocs
  130.         If WizardMode = SBXMLMODE Then
  131.             ImportDialogArea.Title = sTitle & " - " & sSODocumentCheckBox(Index)
  132.         Else
  133.             ImportDialogArea.Title = sTitle & " - " & sMSDocumentCheckBox(Index)
  134.         End If
  135.         If WizardMode = SBXMLMODE AND Index = 3 Then
  136.             ' Note: SO-Helper Applications are partly treated like templates although they only have documents
  137.             .hlnTemplates.Label = sProgressMoreDocs
  138.             .chkTemplatePath.Label = sSOHelperDocuments(0,0)
  139.             .chkTemplatePath.Enabled = oFactoryKey.HasByName(sSOHelperDocuments(0,1))
  140.             .chkDocumentPath.Label = sSOHelperDocuments(1,0)
  141.             .chkDocumentPath.Enabled = oFactoryKey.HasByName(sSOHelperDocuments(1,1))
  142.         Else
  143.             .chkTemplatePath.Enabled = True
  144.             .chkDocumentPath.Enabled = True
  145.             .chkTemplatePath.Label = sTemplateCheckbox(Index)
  146.             .chkDocumentPath.Label = sDocumentCheckbox(Index)
  147.             .hlnTemplates.Label = sProgressMoreTemplates
  148.         End If
  149.         .chkTemplatePath.State = Abs(Applications(CurOffice,SBTEMPLCONVERT))
  150.         ToggleInputPaths(oNullObject,"Template")
  151.         ToggleInputPaths(oNullObject,"Document")        
  152.         .chkTemplateSearchSubDir.State = Abs(Applications(CurOffice,SBTEMPLRECURSIVE))
  153.         .txtTemplateImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLSOURCE))
  154.         .txtTemplateExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLTARGET))
  155.         .cmdGoOn.Label = sNextButton
  156.         .cmdBack.Enabled = True
  157.         ImportDialog.Step = 2
  158.     End With
  159.     ImportDialogArea.GetControl("chkTemplatePath").SetFocus()
  160.     ToggleNextButton()
  161. End Sub
  162.  
  163.  
  164. Sub FillUpApplicationList()
  165. Dim i as Integer
  166. Dim a as Integer
  167. Dim BoolValue as Boolean
  168.     If Not bDoKeepApplValues Then
  169.         a = 0
  170.         For i = 1 To ApplCount
  171.             If ImportDialog.optMSDocuments.State = 1 Then
  172.                 BoolValue = ImportDialogArea.GetControl("chkMSApplication" & i).Model.State = 1
  173.             Else
  174.                 BoolValue = ImportDialogArea.GetControl("chkSOApplication" & i).Model.State = 1
  175.             End If
  176.             Applications(a,SBAPPLCONVERT) = BoolValue
  177.             Applications(a,SBDOCCONVERT) = BoolValue
  178.             Applications(a,SBDOCRECURSIVE) = BoolValue
  179.             Applications(a,SBDOCSOURCE) = ""            ' GetDefaultPath(i)
  180.             Applications(a,SBDOCTARGET) = ""            ' SOWorkPath
  181.             Applications(a,SBTEMPLCONVERT) = BoolValue
  182.             Applications(a,SBTEMPLRECURSIVE) = BoolValue
  183.             Applications(a,SBTEMPLSOURCE) = ""             ' GetTemplateDefaultPath(i)
  184.             Applications(a,SBTEMPLTARGET) = ""             ' GetTargetTemplatePath(i)
  185.             Applications(a,SBAPPLKEY) = i-1
  186.             If BoolValue Then 
  187.                 a = a + 1
  188.             End If
  189.         Next i
  190.         ApplCount = a
  191.     End If
  192. End Sub
  193.  
  194.  
  195. Sub InitializePathsforCurrentApplication(i as Integer)
  196.     AssignPathToCurrentApplication(SBDOCSOURCE, GetDefaultPath(i))
  197.     AssignPathToCurrentApplication(SBDOCTARGET, SOWorkPath)
  198.     AssignPathToCurrentApplication(SBTEMPLSOURCE, GetTemplateDefaultPath(i))
  199.     AssignPathToCurrentApplication(SBTEMPLTARGET, GetTargetTemplatePath(i))
  200. End Sub
  201.  
  202.  
  203. Sub AssignPathToCurrentApplication(Index as Integer, NewPath as String)
  204.     If Applications(CurOffice,Index) = "" Then
  205.         If CurOffice > 0 Then
  206.             Applications(CurOffice,Index) = Applications(CurOffice-1,Index)
  207.         Else
  208.             Applications(CurOffice,Index) = NewPath
  209.         End If
  210.     End If
  211. End Sub
  212.  
  213.  
  214. Sub SaveStep_InputPath()
  215.     Applications(CurOffice,SBDOCCONVERT)  = ImportDialog.chkDocumentPath.State = 1
  216.     Applications(CurOffice,SBDOCRECURSIVE)  = ImportDialog.chkDocumentSearchSubDir.State = 1
  217.     Applications(CurOffice,SBDOCSOURCE)  = ConvertToURL(ImportDialog.txtDocumentImportPath.Text)
  218.     Applications(CurOffice,SBDOCTARGET) = ConvertToUrl(ImportDialog.txtDocumentExportPath.Text)
  219.     Applications(CurOffice,SBTEMPLCONVERT) = ImportDialog.chkTemplatePath.State = 1
  220.     Applications(CurOffice,SBTEMPLRECURSIVE) = ImportDialog.chkTemplateSearchSubDir.State = 1
  221.     Applications(CurOffice,SBTEMPLSOURCE) = ConvertToURL(ImportDialog.txtTemplateImportPath.Text)
  222.     Applications(CurOffice,SBTEMPLTARGET) = ConvertToURL(ImportDialog.txtTemplateExportPath.Text)
  223. End Sub
  224.  
  225.  
  226. Sub ToggleInputPaths(aEvent as Object, Optional sDocType)
  227. Dim bDoEnable as Boolean
  228. Dim sLocDocType as String
  229. Dim oCheckBox as Object
  230.     If Not IsNull(aEvent) Then
  231.         sLocDocType = aEvent.Source.Model.Tag
  232.     Else
  233.         sLocDocType = sDocType
  234.     End If
  235.     With ImportDialogArea
  236.         oCheckBox = .GetControl("chk" & sLocDocType & "Path").Model
  237.         bDoEnable = oCheckBox.State = 1 And oCheckBox.Enabled
  238.         .GetControl("lbl" & sLocDocType & "Import").Model.Enabled = bDoEnable
  239.         .GetControl("lbl" & sLocDocType & "Export").Model.Enabled = bDoEnable
  240.         .GetControl("txt" & sLocDocType & "ImportPath").Model.Enabled = bDoEnable
  241.         .GetControl("txt" & sLocDocType & "ExportPath").Model.Enabled = bDoEnable
  242.         .GetControl("chk" & sLocDocType & "SearchSubDir").Model.Enabled = bDoEnable
  243.         .GetControl("cmd" & sLocDocType & "Import").Model.Enabled = bDoEnable
  244.         .GetControl("cmd" & sLocDocType & "Export").Model.Enabled = bDoEnable
  245.     End With
  246.     ToggleNextButton()
  247. End Sub
  248.  
  249.  
  250. Function MakeSummaryString()
  251. Dim sTmpText As String
  252. Dim i as Integer
  253. Dim Index as Integer
  254. Dim sAddText as String
  255.     For i = 0 To ApplCount -1
  256.         Index = Applications(i,SBAPPLKEY)
  257.         If     Applications(i,SBTEMPLCONVERT) Then
  258.             ' Templates are to be converted
  259.             sAddText = ""
  260.             If WizardMode = SBMICROSOFTMODE Then
  261.                 sAddText = sSumMSTemplates(Index) & sCRLF
  262.             Else
  263.                 sAddText = sSumSOTemplates(Index) & sCRLF            
  264.             End If
  265.             sTmpText = sTmpText & sAddText &  ConvertFromUrl(Applications(i,SBTEMPLSOURCE)) & sCRLF
  266.             If Applications(i,SBTEMPLRECURSIVE) Then
  267.                 ' Including Subdirectories
  268.                 sTmpText = sTmpText & sSumInclusiveSubDir & sCRLF
  269.             End If
  270.             sTmpText = sTmpText & sSumSaveDocuments & sCRLF
  271.             sTmpText = sTmpText & ConvertFromUrl(Applications(i,SBTEMPLTARGET)) & sCRLF
  272.             sTmpText = sTmpText & sCRLF
  273.         End If
  274.  
  275.         If Applications(i,SBDOCCONVERT) Then
  276.             ' Documents are to be converted
  277.             If WizardMode = SBMICROSOFTMODE Then
  278.                 sAddText = sSumMSDocuments(Index) & sCRLF
  279.             Else
  280.                 sAddText = sSumSODocuments(Index) & sCRLF            
  281.             End If
  282.             sTmpText = sTmpText & sAddText & ConvertFromUrl(Applications(i,SBDOCSOURCE)) & sCRLF
  283.  
  284.             If Applications(i,SBDOCRECURSIVE) Then
  285.                 ' Including Subdirectories
  286.                 sTmpText = sTmpText & sSumInclusiveSubDir & sCRLF
  287.             End If
  288.  
  289.             sTmpText = sTmpText & sSumSaveDocuments & sCRLF
  290.             sTmpText = sTmpText & ConvertFromUrl(Applications(i,SBDOCTARGET)) & sCRLF
  291.             sTmpText = sTmpText & sCRLF
  292.         End If
  293.     Next i
  294.     MakeSummaryString = sTmpText
  295. End Function
  296.  
  297.  
  298. Sub FillStep_Summary()
  299.     ImportDialogArea.Title = sTitle
  300.     With ImportDialog
  301.         .SummaryTextbox.Text = MakeSummaryString()
  302.         .cmdGoOn.Enabled = .SummaryTextbox.Text <> ""
  303.         .cmdGoOn.Label = sBeginButton
  304.         .SummaryHeaderLabel.Label = sSummaryHeader
  305.         .Step = 3
  306.     End With
  307.     ImportDialogArea.GetControl("SummaryHeaderLabel").SetFocus()                    
  308. End Sub
  309.  
  310.  
  311. Sub FillStep_Progress()
  312.     With ImportDialog
  313.         .cmdBack.Enabled = False
  314.         .cmdGoOn.Enabled = False
  315.         .hlnProgress.Label = sProgressPage_1
  316.         .LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD
  317.             .LabelRetrieval.Label = sProgressPage_2
  318.             .LabelCurProgress.Label = sProgressPage_3
  319.             .LabelCurDocumentRetrieval.Label = ""
  320.             .LabelCurTemplateRetrieval.Label = ""
  321.            .LabelCurDocument.Label = ""
  322.         .Step = 4
  323.     End With
  324.     ImportDialogArea.GetControl("LabelRetrieval").SetFocus()
  325.     If ImportDialog.chkLogfile.State = 1 Then
  326.         ImportDialog.cmdShowLogFile.DefaultButton = True
  327.     End If
  328. End Sub
  329.  
  330.  
  331. Sub    SetupMSConfiguration()
  332.     iApplSection = 0
  333.     Wizardmode = SBMICROSOFTMODE
  334.     MaxApplCount = 3
  335.     ApplCount = 3
  336.  
  337.     sKeyName(0) = "Software\Microsoft\Office\8.0\Word\Options"
  338.     sKeyName(1) = "Software\Microsoft\Office\8.0\Excel\Microsoft Excel"
  339.     sKeyName(2) = "Software\Microsoft\Office\8.0\PowerPoint\Recent Folder List\Default"
  340.  
  341.     sValueName(0) = "DOC-PATH"
  342.     sValueName(1) = "DefaultPath"
  343.     sValueName(2) = ""
  344.  
  345. ' See definition of Filtername-Array about meaning of fields
  346.     MSFilterName(0,0) = "doc"
  347.     MSFilterName(0,1) = "StarOffice XML (Writer)"
  348.     MSFilterName(0,2) = "sxw"
  349.  
  350.     MSFilterName(1,0) = "xls"
  351.     MSFilterName(1,1) = "StarOffice XML (Calc)"
  352.     MSFilterName(1,2) = "sxc"
  353.  
  354.     MSFilterName(2,0) = "ppt"
  355.     MSFilterName(2,1) = "StarOffice XML (Impress)"
  356.     MSFilterName(2,2) = "sxi"
  357.  
  358.     MSFilterName(3,0) = "dot"
  359.     MSFilterName(3,1) = "writer_StarOffice_XML_Writer_Template"
  360.     MSFilterName(3,2) = "stw"
  361.  
  362.     MSFilterName(4,0) = "xlt"
  363.     MSFilterName(4,1) = "calc_StarOffice_XML_Calc_Template"
  364.     MSFilterName(4,2) = "stc"
  365.  
  366.     MSFilterName(5,0) = "pot"
  367.     MSFilterName(5,1) = "impress_StarOffice_XML_Impress_Template"
  368.     MSFilterName(5,2) = "sti"
  369. End Sub
  370.  
  371.  
  372. Sub SetupXMLConfiguration()
  373.     iApplSection = 1000
  374.     Wizardmode = SBXMLMODE
  375.     ApplCount = 4
  376.     MaxApplCount = 4
  377.  
  378.     XMLFilterName(0,0) = "sdw"
  379.     XMLFilterName(0,1) = "StarOffice XML (Writer)"
  380.     XMLFilterName(0,2) = "sxw"
  381.  
  382.     XMLFilterName(1,0) = "sdc"
  383.     XMLFilterName(1,1) = "StarOffice XML (Calc)"
  384.     XMLFilterName(1,2) = "sxc"
  385.  
  386.     XMLFilterName(2,0) = "sdd|sda"
  387.     XMLFilterName(2,1) = "StarOffice XML (Impress)|sdraw: StarOffice XML (Draw)"
  388.     XMLFilterName(2,2) = "sxi|sxd"
  389.  
  390.     XMLFilterName(3,0) = "smf"
  391.     XMLFilterName(3,1) = "StarOffice XML (Math)"
  392.     XMLFilterName(3,2) = "sxm"
  393.  
  394.     XMLFilterName(4,0) = "application/vnd.stardivision.writer;application/x-starwriter|application/vnd.stardivision.writer/web"
  395.     XMLFilterName(4,1) = "writer_StarOffice_XML_Writer_Template|writer_web_StarOffice_XML_Writer_Web_Template"
  396.     XMLFilterName(4,2) = "stw|stw"
  397.  
  398.     XMLFilterName(5,0) = "application/vnd.stardivision.calc;application/x-starcalc"
  399.     XMLFilterName(5,1) = "calc_StarOffice_XML_Calc_Template"
  400.     XMLFilterName(5,2) = "stc"
  401.  
  402.     XMLFilterName(6,0) = "application/vnd.stardivision.impress;application/x-starimpress|application/vnd.stardivision.draw;application/x-stardraw"
  403.     XMLFilterName(6,1) = "impress_StarOffice_XML_Impress_Template|draw_StarOffice_XML_Draw_Template"
  404.     XMLFilterName(6,2) = "sti|std"
  405.  
  406.     XMLFilterName(7,0) = "sgl"
  407.     XMLFilterName(7,1) = "writer_globaldocument_StarOffice_XML_Writer_GlobalDocument"
  408.     XMLFilterName(7,2) = "sxg"
  409. End Sub
  410.  
  411.  
  412. Function CheckControlPath(oCheckbox as Object, oTextBox as Object, ByVal bDoEnable as Boolean)
  413. Dim sPath as String
  414.     If Not bDoEnable Then
  415.         CheckControlPath = False
  416.     ElseIf oCheckbox.State = 0 Then
  417.         CheckControlPath = True
  418.     Else
  419.         sPath = ConvertToUrl(Trim(oTextBox.Text)
  420.         CheckControlPath = oUcb.Exists(sPath)
  421.     End If
  422. End Function
  423.  
  424.  
  425. Function CheckInputPaths() as Boolean
  426. Dim bChangePage as Boolean
  427.     bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateImportPath, True, False, sTitle, False)
  428.     bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateExportPath, bChangePage, True, sTitle, False)
  429.     bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentImportPath, bChangePage, False, sTitle, False)
  430.     bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentExportPath, bChangePage, True, sTitle, False)
  431.     CheckInputPaths = bChangePage
  432. End Function
  433.  
  434.  
  435. Function CheckTextBoxPath(oTextBox as Object, ByVal bCheck as Boolean, bCreateNew as Boolean, sTitle as String, bgetResources as Boolean) as Boolean
  436. Dim iCreate as Integer
  437. Dim sQueryMessage as String
  438. Dim sUrlPath as String
  439. Dim sMessageNoDir as String
  440. Dim sShowPath as String
  441. Dim oLocUcb as Object
  442.     oLocUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
  443.     If bGetResources Then
  444.         If InitResources("ImportWizard","imp") then
  445.              sNoDirCreation = GetResText(1050)
  446.             sMsgDirNotThere = GetResText(1051)
  447.             sQueryForNewCreation = GetResText(1052)
  448.         Else
  449.             CheckTextBoxPath() = False
  450.             Exit Function
  451.         End If
  452.     End If
  453.     If oTextBox.Enabled Then
  454.         If bCheck Then
  455.             sShowPath = oTextBox.Text
  456.             sUrlPath = ConvertToUrl(sShowPath)
  457.             If Not oLocUcb.Exists(sUrlPath) Then
  458.                 If Not bCreateNew Then
  459.                     ' Sourcedirectories must be existing, Targetdirectories may be created new
  460.                     sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,"%1")
  461.                     Msgbox(sQueryMessage,16,sTitle)
  462.                     CheckTextBoxPath() = False
  463.                     Exit Function
  464.                 Else
  465.                     sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,"%1")
  466.                     sQueryMessage = sQueryMessage & Chr(13) & sQueryForNewCreation
  467.                     iCreate = Msgbox (sQueryMessage, 36, sTitle)
  468.                     If iCreate = 6 Then
  469.                         On Local Error Goto NOVALIDPATH
  470.                         CreateFolder(sUrlPath)
  471.                         If Not oLocUcb.Exists(sUrlPath) Then
  472.                             Goto NOVALIDPATH
  473.                         End If
  474.                     Else
  475.                         CheckTextBoxPath() = False
  476.                         Exit Function
  477.                     End If
  478.                 End If
  479.             End If
  480.             CheckTextBoxPath() = True
  481.         Else
  482.             CheckTextBoxPath() = False
  483.         End If
  484.     Else
  485.         CheckTextBoxPath() = True
  486.     End If
  487.     Exit Function
  488. NOVALIDPATH:
  489.     sMessageNoDir = ReplaceString(sNoDirCreation, sShowPath, "%1")
  490.     Msgbox(sMessageNoDir, 16, sTitle)
  491.     CheckTextBoxPath() = False
  492. End Function
  493.  
  494.  
  495. Sub InitializeProgressPage(oDialog as Object)
  496.   oDialog.LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.NORMAL
  497.   oDialog.LabelCurProgress.FontWeight = com.sun.star.awt.FontWeight.BOLD
  498. End Sub
  499.  
  500.  
  501. Sub    SetProgressDisplay(AbsFound as Integer)
  502.     ImportDialog.LabelRetrieval.Label = sProgressPage_2 &  "  " & ReplaceString(sProgressPage_5, Str(AbsFound) & " ", "%1")
  503.     ImportDialog.LabelCurDocumentRetrieval.Label =  sProgressFound & " " & CStr(AbsDocuFound) &  " " & sProgressMoreDocs
  504.     ImportDialog.LabelCurTemplateRetrieval.Label = sProgressFound & " " & CStr(AbsTemplateFound) & " " & sProgressMoreTemplates
  505. End Sub
  506.  
  507. Sub TakoverFolderName(aEvent as Object)
  508. Dim RefControlName as String
  509. Dim oRefControl
  510.     RefControlName = aEvent.Source.Model.Tag
  511.     oRefControl = ImportDialogArea.GetControl(RefControlName)
  512.     GetFolderName(oRefControl.Model)
  513.     ToggleNextButton()
  514. End Sub
  515.  
  516.  
  517. Sub FinalizeDialogButtons()    
  518.     ImportDialog.cmdShowLogFile.Enabled = ((Isnull(oLogDocument) = False) And (ImportDialog.chkLogfile.State = 1))
  519.     ImportDialog.cmdCancel.Enabled = False
  520.     ImportDialog.cmdGoOn.Label = sCloseButton
  521.     ImportDialog.cmdGoOn.Enabled = True
  522. End Sub    
  523. </script:module>